<?php include $this->admin_tpl('meta');?>
<title>箱及库位</title>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/jquery/1.8.2/jquery.min.js"></script> 
</head>
<style>

</style>
<body>
<div class="page-container" style="padding-bottom:0;">
	<form id="search">
		<input type="hidden" value="" name="field">
		<input type="hidden" value="" name="order">
		<input type="hidden" value="0" name="download">
		<div class="c"><input type="text" name="i_id" class="input-text" style="width:130px" placeholder="款式编码,*号开头模糊匹配" value="<?php if(isset($_GET['i_id'])) echo $_GET['i_id'];?>"></div>
		<div class="c"><input type="text" name="sku_id" class="input-text" style="width:130px" placeholder="商品编码,*号开头模糊匹配" value="<?php if(isset($_GET['sku_id'])) echo $_GET['sku_id'];?>"></div>
		<div class="c"><input type="text" name="name" class="input-text" autocomplete="off" style="width:130px" placeholder="商品名称" value="<?php if(isset($_GET['name'])) echo $_GET['name'];?>"></div>
		<div class="c"><input type="text" name="properties_value" class="input-text" autocomplete="off" style="width:130px" placeholder="颜色尺码" value="<?php if(isset($_GET['properties_value'])) echo $_GET['properties_value'];?>"></div>
		<div class="c"><input type="text" name="other_2" class="input-text" style="width:130px" placeholder="其他属性2" value="<?php if(isset($_GET['other_2'])) echo $_GET['other_2'];?>"></div>
		<?php include $this->admin_tpl('jst_common/select_brand');?>
		<div class="select-box inline" style="float:left;">
			<select name="pack_type" class="select">
				<option value="Bin" selected>仓位库存</option>
				<option value="DefaultPack">暂存位</option>
				<option value="Pack">装箱库存</option>
			</select>
		</div>
		<a class="btn btn-success radius" href="javascript:void(0)" id="btn_search"><i class="yzm-iconfont yzm-iconsousuo"></i> 搜索</a>
		<button class="btn btn-primary radius" id="btn_reset" type="reset"><i class="yzm-iconfont yzm-iconshuaxin"></i> 重置</button>
	</form>
	
	<table id="table" class="mt-20" lay-filter="table" style="font-size:12px;"></table>
</div>
<?php include $this->admin_tpl('jst_common/common_tpl');?>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/layui.js"></script>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script>
var db = 'jst_inventorys';
layui.use(function(){ //亦可加载特定模块：layui.use(['layer', 'laydate', function(){
	table = layui.table; //表格
	util = layui.util; //工具集
	dropdown = layui.dropdown; //下拉菜单
	form = layui.form;
	//执行一个 table 实例
	option = {
		elem: '#table',
		id:'table',
		height: 'full-80',
		limit:30,
		limits:[20,60,90],
		url:'<?php echo U('pack_query');?>',
		method:'post',
		where: $('#search').serializeJson(),
		title: '商品列表',
		autoSort: false,
		totalRow: true, // 开启合计行
		page: {theme:'#409eff',groups:3,hash:true}, //开启分页
		//toolbar: '#tool_temp', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
		cols: [[ //表头
			{type: 'checkbox'},
			{field: 'id', title: 'ID', width:80,align:'center'},
			{field: 'pic', title: '图片', width:40,align:'center',templet: '#pic_tpl'},
			{field: 'i_id', title: '款式编码', width:150,align:'left',templet:'#vip_link'},
			{field: 'sku_id', title: '商品编码', width:150,align:'left'},
			{field: 'sku_code', title: '国标码', width:150,align:'left'},
			{field: 'other_2', title: '其他属性2',align:'left',width:180},
			{field: 'properties_value', title: '商品属性',align:'left',width:150},
			{field: 'name', title: '商品名称'},
			{field: 'wms_name', title: '存储方',align:'center',width:150},
			//{field: 'wms_co_id', title: '存储方仓库id',align:'center',width:150},
			{field: 'item_bin', title: '仓位/箱',align:'center',width:150,templet:function(row){
				if(row.pack_type=='Bin'){
					return row.bin;
				}else if(row.pack_type=='Pack'){
					return row.pack_id;
				}else{
					return '--';
				}
			}},
			{field: 'wh_name', title: '所在仓库',align:'center',width:150},
			{field: 'jst_name', title: '库存来源',align:'center',width:80,totalRow: '小计：'},
			{field: 'qty', title: '主仓',align:'center',width:50,sort:true,totalRow:true,totalRowDecimals:0},
			{field: 'modified', title: '修改时间',align:'center',sort:true,width:110}
		]],
		done:function(res,curr,count){
			$('.qty_sum').remove();
			$('.layui-table-page').append('<div class="layui-inline f-l qty_sum" style="line-height:26px;">主仓库存共 <span class="c-primary f-16">'+res.qty_sum+'</span> 件</div>');
			var options = this;
			public_table(db);
		}
	};
	table.render(option);
	table.hideCol('table', {
	  field: 'id', // 对应表头的 field 属性值
	  hide: true // `true` or `false`
	});
	table.hideCol('table', {
	  field: 'sku_code', // 对应表头的 field 属性值
	  hide: true // `true` or `false`
	});
	init_table(db);	
})
</script>
</body>
</html>